import logging
from pathlib import Path

# 日志配置
LOG_CONFIG = {
    "version": 1,
    "formatters": {
        "standard": {
            "format": "%(asctime)s [%(module)s] [%(levelname)s] %(message)s",
            "datefmt": "%Y-%m-%d %H:%M:%S"
        }
    },
    "handlers": {
        "file": {
            "class_key": "logging.handlers.RotatingFileHandler",
            "level": logging.WARNING,
            "formatter": "standard",
            "filename": Path(__file__).parent / "log/app.log",
            "maxBytes": 5 * 1024 * 1024,  # 5MB
            "backupCount": 3,
            "encoding": "utf-8"
        }
    },
    "root": {
        "level": logging.WARNING,
        "handlers": ["file"]
    }
}

password: str = "123456"

# 压缩类型配置
COMPRESS = {"zip", "sevenzip", "rar", "tar", "iso", "cab", "jpeg"}

path_test = Path(Path(__file__).parent / r"log\unzip.7z").resolve()
# 自动创建日志目录
log_dir = Path(LOG_CONFIG["handlers"]["file"]["filename"]).parent
log_dir.mkdir(parents=True, exist_ok=True)
